//
//  RouteViewController.m
//  MapEXPO
//
//  Created by 洪雯 on 16/4/2.
//  Copyright © 2016年 洪雯. All rights reserved.
//

#import "RouteViewController.h"
#import "RouteTableViewCell.h"

@interface RouteViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic, strong) UITableView * tableView;
@property (nonatomic, strong) NSArray * titleArr;
@property (nonatomic, strong) NSArray * contentArr;

@end

@implementation RouteViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self createTableView];
    [self initData];
}

- (void)createTableView
{
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) style:UITableViewStylePlain];
    _tableView.dataSource = self;
    _tableView.delegate = self;
    
    [self.view addSubview:_tableView];
    
    // 把分割线重新设置  15个像素置前
    if ([_tableView respondsToSelector:@selector(setSeparatorInset:)]) {
        [_tableView setSeparatorInset:UIEdgeInsetsZero];
    }
    if ([_tableView respondsToSelector:@selector(setLayoutMargins:)]) {
        [_tableView setLayoutMargins:UIEdgeInsetsZero];
    }

}

- (void)initData
{
    _titleArr = @[@"1小时浏览路线",@"2小时浏览路线",@"3小时浏览路线",@"4小时浏览路线",@"5小时浏览路线",@"6小时浏览路线"];
    _contentArr = @[@"适合灰常灰常灰常捉急的游客",@"适合灰常灰常捉急的游客",@"适合灰常捉急的游客",@"适合大众的游客",@"适合体力充沛的游客",@"适合辣么有体力的游客"];
}

#pragma mark UITableViewDataSource & UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _titleArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellId = @"cellid";
    RouteTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cellId];
    if (!cell) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"RouteTableViewCell" owner:nil options:nil] lastObject];
    }
    //显示箭头
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.titleLabel.text = _titleArr[indexPath.row];
    cell.contentLabel.text = _contentArr[indexPath.row];
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 70;
}



@end
